//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    internal class TablePartStyle : IOfficeXmlSerializableAs
    {
        private TableStyleCellStyle _tcStyle;
        private TableStyleTextStyle _tcTxStyle;

        #region IOfficeXmlSerializableAs Members

        public void ReadXmlAs(string name, ReadContext context)
        {
            using (var c = context.Read(name))
            {
                _tcTxStyle = c.ReadOptionalElement<TableStyleTextStyle>("tcTxStyle");
                _tcStyle = c.ReadOptionalElement<TableStyleCellStyle>("tcStyle");
            }
        }

        public void WriteXmlAs(string name, WriteContext context)
        {
            using (var c = context.Write(name))
            {
                c.WriteOptionalElement(_tcTxStyle);
                c.WriteOptionalElement(_tcStyle);
            }
        }

        #endregion
    }
}